﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using CMS.BLL;

public partial class Controls_Cruise_ctrCruiseNavigation : System.Web.UI.UserControl
{
    private int nCurrentLanguage = Support.GetCurrentLanguage();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.SetLabel();
        }
    }

    private void SetLabel()
    {
        lnkHome.Text = MultipleLanguage.HOME[nCurrentLanguage - 1];
        int nCountry = ConvertData.ConvertToInt(Request.QueryString["cid"]);
        lnkCruise.Text = MultipleLanguage.CRUISE_TITLE[nCurrentLanguage - 1];
        ltrCruiseDetail.Visible = false;
        if (nCountry == 0)
            nCountry = 1;
        switch (nCountry)
        {
            case 1:
                lnkCountry.Text = "Vietnam";
                lnkCountry.NavigateUrl = "~/Default.aspx?cid=1";
                lnkHome.NavigateUrl = "~/Default.aspx?cid=1";
                lnkCruise.NavigateUrl = "~/Cruise.aspx?cid=1";
                break;
            case 2:
                lnkCountry.Text = "Laos";
                lnkCountry.NavigateUrl = "~/Default.aspx?cid=2";
                lnkHome.NavigateUrl = "~/Default.aspx?cid=2";
                lnkCruise.NavigateUrl = "~/Cruise.aspx?cid=2";
                break;
            case 3:
                lnkCountry.Text = "Cambodia";
                lnkCountry.NavigateUrl = "~/Default.aspx?cid=3";
                lnkHome.NavigateUrl = "~/Default.aspx?cid=3";
                lnkCruise.NavigateUrl = "~/Cruise.aspx?cid=3";
                break;
        }

        int nCruiseID = ConvertData.ConvertToInt(Request.QueryString[Config.CRUISEID]);
        int nRegion = ConvertData.ConvertToInt(Request.QueryString[Config.CRUISEREGION]);
        
        if (nRegion != 0)
        {
            ltrCruiseDetail.Visible = true;
            if (nRegion == 1)
            {
                ltrCruiseDetail.Text = "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=1&"+ Config.CRUISEREGION +"=1'>" + MultipleLanguage.HALONGCRUISE[nCurrentLanguage - 1] + "</a>";
            }
            else if(nRegion == 2)
            {
                ltrCruiseDetail.Text = "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=1&" + Config.CRUISEREGION + "=2'>" + MultipleLanguage.MEKONGCRUISE[nCurrentLanguage - 1] + "</a>";
            }
        }

        if (nCruiseID != 0)
        {
            try
            {
                ltrCruiseDetail.Visible = true;
                Cruise objCruise = new Cruise();
                objCruise.LoadById(nCruiseID);
                string sRegion = "";
                if (objCruise.Data.CruiseRegion == 1 && objCruise.Data.CountryID==1)
                    sRegion = "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=1&" + Config.CRUISEREGION + "=1'>" + MultipleLanguage.HALONGCRUISE[nCurrentLanguage - 1] + "</a>&nbsp;";
                else if (objCruise.Data.CruiseRegion == 2 && objCruise.Data.CountryID == 1)
                    sRegion = "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=1&" + Config.CRUISEREGION + "=2'>" + MultipleLanguage.MEKONGCRUISE[nCurrentLanguage - 1] + "</a>&nbsp;";

                if (objCruise.Data.Type == 1)
                    sRegion = sRegion + "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=" + objCruise.Data.CountryID + "&" + Config.CRUISEREGION + "="  + objCruise.Data.CruiseRegion
                        + "&"+ Config.CRUISETYPE +"=1'>" + MultipleLanguage.PRIVATE_CRUISETYPE[nCurrentLanguage - 1] + "</a>";
                else if (objCruise.Data.Type == 2)
                    sRegion = sRegion + "<img src=\"images/Layout/ico-bullet-3.png\" /><a href='Cruise.aspx?cid=" + objCruise.Data.CountryID + "&" + Config.CRUISEREGION + "=" + objCruise.Data.CruiseRegion
                        + "&" + Config.CRUISETYPE + "=2'>" + MultipleLanguage.LUXURY_CRUISETYPE[nCurrentLanguage - 1] + "</a>";

                switch (nCurrentLanguage)
                {
                    case 1:
                        ltrCruiseDetail.Text = sRegion + "&nbsp;<img src=\"images/Layout/ico-bullet-3.png\" />" + objCruise.Data.Title1;
                        break;
                    case 2:
                        ltrCruiseDetail.Text = sRegion + "&nbsp;<img src=\"images/Layout/ico-bullet-3.png\" />" + objCruise.Data.Title2;
                        break;
                    case 3:
                        ltrCruiseDetail.Text = sRegion + "&nbsp;<img src=\"images/Layout/ico-bullet-3.png\" />" + objCruise.Data.Title3;
                        break;
                }
            }
            catch
            {
                Response.Redirect("~/Default.aspx");
            }
            

        }
    }
}